package com.campus.client.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.campus.pojos.domain.ClientCourse;
import com.campus.result.Result;
import com.campus.service.CourseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 课程相关接口
 */
@RestController
@RequestMapping("/client/course")
@Slf4j
public class CourseController {

    @Autowired
    private CourseService courseService;
    /**
     * 获取用户课程信息
     */
    @GetMapping("/get/{id}")
    public Result<List<ClientCourse>> getCourseList(@PathVariable Long id){
        QueryWrapper<ClientCourse> qw= new QueryWrapper<>();
        qw.eq("user_id", id);
        return Result.success(courseService.list(qw));
    }
}
